TextEncodingRun
It is not always possible to convert text expressed in Unicode to another single encoding because no other single encoding encompasses the Unicode character encoding range. To adjust for this, you can create a Unicode mapping structure array that specifies the target encodings the Unicode text should be converted to when multiple encodings must be used.If the
kUnicodeTextRunMask
flag is set,ConvertFromUnicodeToTextRun
andConvertFromUnicodeToScriptCodeRun
may convert Unicode text to a string of text containing multiple text encoding runs. Each run contains text expressed in a different encoding from that of the preceding or following text segment. For each text encoding run in the string, aTextEncodingRun
structure indicates the beginning offset and the text encoding for that run.Functions that convert text from Unicode to a text run return the converted text in an array of text encoding run structures. A text encoding run structure is defined by the
TextEncodingRun
data type.
struct TextEncodingRun { ByteOffset offset; TextEncoding textEncoding; }; typedef struct TextEncodingRun TextEncodingRun;
Field Description
offset
- The beginning character position of a run of text in the converted text string.
textEncoding
- The encoding of the text run that begins at the position specified.
struct TextEncodingRun { ByteOffset offset; TextEncoding textEncoding; };
Field Description
offset
- The byte offset at which the given text encoding begins. The offset is from the beginning of the text buffer.
textEncoding
- The text encoding that begins at the byte offset.